//
//  FloorOneCell.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/11.
//  Copyright © 2017年 金橙云. All rights reserved.
//


#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)

#import "FloorOneCell.h"

@implementation FloorOneCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
                self.dataArr = [NSArray new];
        _titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
        _titleLab.backgroundColor = [UIColor orangeColor];
        _titleLab.textColor = [UIColor whiteColor];
        _titleLab.text = @"   搂撞去化";
        _titleLab.font = [UIFont systemFontOfSize:14];
        [self addSubview:_titleLab];
        
        _lineChart = [[ZFLineChart alloc] initWithFrame:CGRectMake(-40, 30,SCREEN_WIDTH+40, 265)];
        //self.lineChart.topicLabel.textColor = ZFBlack;
        self.lineChart.dataSource = self;
        self.lineChart.delegate = self;
        self.lineChart.isResetAxisLineMinValue = YES;
        self.lineChart.isShowXLineSeparate = YES;
        self.lineChart.isShowYLineSeparate = YES;
        self.lineChart.valueType = kValueTypeDecimal;
        self.lineChart.numberOfDecimal = 1;
        self.lineChart.linePatternType = kLinePatternTypeForCurve;

        [self addSubview:self.lineChart];
        [self.lineChart strokePath];

        
    }
    return  self;
}

#pragma mark - ZFGenericChartDataSource

- (NSArray *)valueArrayInGenericChart:(ZFGenericChart *)chart{
    if (self.dataArr.count!=0) {
        if (self.row==0) {
            return self.dataArr[self.row][0];
            
        }else{
            return self.dataArr[self.row-1][0];
            
        }

    }
    return 0;
   // return @[@"0", @"20%", @"8.9%", @"20%", @"5%", @"10%"];
}

- (NSArray *)nameArrayInGenericChart:(ZFGenericChart *)chart{
    if (self.dataArr.count!=0) {

        if (self.row==0) {
            return self.dataArr[self.row][1];
            
        }else{
            return self.dataArr[self.row-1][1];
            
        }
    }
    return 0;
   // return _dataArr[self.row][1];

   // return @[@"一年级", @"二年级", @"三年级", @"四年级", @"五年级", @"六年级"];
}


- (NSArray *)colorArrayInGenericChart:(ZFGenericChart *)chart{
    //曲线的颜色
    return @[ZFLvColor];
    //return [];
}

- (CGFloat)axisLineMaxValueInGenericChart:(ZFGenericChart *)chart{
    return 100;
}


//背景格格
- (NSUInteger)axisLineSectionCountInGenericChart:(ZFGenericChart *)chart{
    return 10;
}

- (void)createUI{
    //创建一个UIView比self.contentView小一圈
    self.bgView  = [[UIView alloc] initWithFrame:CGRectMake(0,4, SCREEN_WIDTH, 296)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(2,2);
    self.bgView.layer.shadowOpacity = 0.3;
    self.bgView.layer.shadowColor = [UIColor blackColor].CGColor;
    [self.contentView addSubview:self.bgView];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
